package com.stx.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.stx.pojo.Ruanyue;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface RuanyueMapper extends BaseMapper<Ruanyue> {

    @Select("select * from r_ruanyue")
    List<Ruanyue> selectruanyue();

    @Select("select * from r_ruanyue where rua_name=#{ruaName} limit 1")
    Ruanyue findByName(@Param("ruaName") String ruaName);

    @Insert("insert into r_ruanyue(id,rua_number,rua_name,rua_subject,rua_address,rua_department,rua_state,rua_date)"+
            "values (#{id},#{ruaNumber},#{ruaName},#{ruaSubject},#{ruaAddress},#{ruaDepartment},#{ruaState},#{ruaDate})")
    void add(Ruanyue ruanyue);

    @Update("update r_ruanyue set rua_number=#{ruaNumber},rua_name=#{ruaName},rua_subject=#{ruaSubject},rua_address=#{ruaAddress},rua_department=#{ruaDepartment},rua_state=#{ruaState},rua_date=#{ruaDate} where id=#{id}")
    void updateID(Ruanyue ruanyue);

    @Delete("delete * from r_ruanyue where id=#{id}")
    void deleteID(Integer id);
}
